<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<%@page import="b1w1nn1ng.crossf1t.gui.*, java.util.*, java.sql.*, b1w1nn1ng.crossf1t.business.*"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<title> Account Settings </title>
		<jsp:include page="/detectBrowser.jsp" />	
	</head>
	
	<%
		User user = (User) session.getAttribute("user");
		session.setAttribute("user", user); 
		
		if (request.getParameter("newUsername") != null) {
			String newUsername = request.getParameter("newUsername");
			user.setUsername(newUsername);
		}
		
		if (request.getParameter("newPassword") != null) {
			String newPassword = request.getParameter("newPassword");
			user.setPassword(newPassword);
		}
		
		if (request.getParameter("newEmail") != null) {
			String newEmail = request.getParameter("newEmail");
			user.setEmail(newEmail);
		}
	%>
	<body>

		<div id="container">
		<jsp:include page="/navbar.jsp" />	

		<h1> Settings </h1> <hr />
			<table id="settingsTable" style="padding-bottom:0px; width:100%;">
				<tr>
					<td><a href="settings.jsp"><img
					src="/crossfit/img/blackbutton_settings_accountSettings.png"  alt="Account Settings" /> </a></td>
					<td><a href="settingsReport.jsp"><img 
					src="/crossfit/img/blackbutton_settings_reportSettings.png" alt="Report Settings" /> </a></td>
				</tr>
				<tr>
					<td style="margin-right: 30px; font-size:80%;">Account Settings</td>
					<td style="margin-right: 30px; font-size:80%;">Report Settings</td>
				</tr>
			</table>
			
			<br /><br /><br />

		<h1></h1>

	
		<form method="get" action="home.jsp" style="margin-top: -80px;">	
			<table id="settingsTableAlign">
				<tr>
					<td style="text-align:left;">Username:</td>
					<td style="text-align:left;"> <%= user.getUsername() %> </td>
					<td> <a href="settings/settingsUsername.jsp" class="changeButton2"> Change</a> </td>
				</tr>
				<tr>
					<td style="text-align:left;" >Password:</td>
					<td style="text-align:left;"> **** </td>
					<td> <a href="settings/settingsPassword.jsp"  class="changeButton2"> Change</a> </td>
				</tr>
				<tr>
					<td style="text-align:left;" >Email:</td>
					<td style="text-align:left;">  <%= user.getEmail() %>  </td>
					<td> <a href="settings/settingsEmail.jsp" class="changeButton2"> Change</a> </td>
				</tr>
				<tr>
					<td style="text-align:left;">Secret Number </td>
					<td ><%= user.getFriendCode() %></td>
					<td> </td>
				</tr>
			</table>
		</form>
		
		</div>
		</body>
</html>





